package so.sao.code.service.infrastructure.jpa.convert;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

import so.sao.code.service.domain.CodeType;

@Converter(autoApply = true)
public class CodeTypeConvert implements AttributeConverter<CodeType, Integer> {

	@Override
	public Integer convertToDatabaseColumn(CodeType attribute) {
		return attribute.getValue();
	}

	@Override
	public CodeType convertToEntityAttribute(Integer dbData) {
		return CodeType.get(dbData);
	}

}
